package com.hiwhitley.easy.day28;

/**
 * Created by hiwhitley on 2016/10/28.
 */
public class IntegerBreak_343 {
    public int integerBreak(int n) {
        if(n == 2)
            return 1;
        else if(n == 3)
            return 2;
        else if(n%3 == 0)
            return (int) Math.pow(3, n/3);
        else if(n%3 == 1)
            return 2 * 2 * (int) Math.pow(3, (n - 4) / 3);
        else
            return 2 * (int) Math.pow(3, n/3);
    }

    public static void main(String[] args) {
        IntegerBreak_343 main = new IntegerBreak_343();
        System.out.println(main.integerBreak(23));
    }

}
